{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">员工服务费</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('banner.banner/add')}"
                   data-auth-edit="{:$auth->check('banner.banner/edit')}"
                   data-auth-delete="{:$auth->check('banner.banner/del')}"></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/html" id="picTpl">
    <img style="max-width:100px; max-height:60px;" src="{{d.img}}" data-image="{{d.title}}">
</script>

<script type="text/html" id="barTool">

    <a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?id={{ d.id }}' data-title="编辑内容">编辑</a>
    <a href='{:url("del",["catid"=>$catid])}?ids={{ d.id }}'
       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>
</script>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" data-href='{:url("setstate")}?id={{d.id}}' value="{{d.id}}"
           lay-skin="switch"
           lay-text="启动|关闭" lay-filter="switchStatus" {{ d.status==1 ? 'checked' : '' }}>
</script>

<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;
        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}?package_id={$package_id}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
        };
        var proviec = {:json_encode($proviec)};
        table.render({
            init: init,
            toolbar: ['refresh', 'add'],
            // toolbar: ['refresh'],
            url: '{:url("index")}?package_id={$package_id}',
            search: true,
            cols: [
                [
                    {field: 'id', width:'10%',align: "center", title: 'ID'},
                    {field: 'package_name', width: '15%',align: "center", title: '套餐名称',search:false},
                    {field: 'salesperson_id', width: '15%',align: "center", title: '员工id'},
                    {field: 'sale_name', width: '15%',align: "center", title: '员工姓名'},

                    {field: 'reward2', width: '15%',align: "center", title: '员工奖励',search:false},
                    {field: 'commission2', width: '15%',align: "center", title: '员工服务费',search:false},
                    {fixed: 'right', width: '15%',  align: "center", title: '操作', toolbar: '#barTool'}
                ]
            ],
            page: {}
        });
        yznTable.bindevent();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
    });
</script>
{/block}